/**
 * 
 */
package com.nc.delivery_project.shared.locator;

import com.google.web.bindery.requestfactory.shared.Locator;
import com.nc.delivery_project.server.domain.Country;
import com.nc.delivery_project.server.service.CountryService;
import com.nc.delivery_project.shared.servicelocator.CountryServiceLocator;


/**
 * @author NataG
 *
 */
public class CountryLocator extends Locator<Country, Integer> {

	@Override
	public Country create(Class<? extends Country> arg0) {
		return new Country();
	}

	@Override
	public Country find(Class<? extends Country> arg0, Integer id) {
		return ((CountryService) new CountryServiceLocator().getInstance(null)).read(id);
	}

	@Override
	public Class<Country> getDomainType() {
		return Country.class;
	}

	@Override
	public Integer getId(Country arg0) {
		return arg0.getCountryId();
	}

	@Override
	public Class<Integer> getIdType() {
		return Integer.class;
	}

	@Override
	public Object getVersion(Country arg0) {
		return arg0.getCountryId();
	}

}
